import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const routes: RouteRecordRaw[] = [
  {
    path: '/',
    redirect: '/recommend',
    name: 'Home',
    component: () => import('@/views/Home'),
    meta: { title: '首頁' },
    children: [
      {
        path: '/recommend',
        name: 'Recommend',
        component: () => import('@/views/Recommend'),
        meta: { title: '推薦' },
      },
      {
        path: '/follow',
        name: 'Follow',
        component: () => import('@/views/Follow'),
        meta: { title: '關注' },
      },
      {
        path: '/college',
        name: 'College',
        component: () => import('@/views/College'),
        meta: { title: '學院' },
      },
    ],
  },
  {
    path: '/mine',
    name: 'Mine',
    component: () => import('@/views/Mine'),
    meta: { title: '我的' },
  },
  {
    path: '/publish',
    name: 'Publish',
    component: () => import('@/views/Publish'),
    meta: { title: '發佈' },
  },
  {
    path: '/messages',
    name: 'Messages',
    component: () => import('@/views/Messages'),
    meta: { title: '消息' },
  },
  {
    path: '/search',
    name: 'Search',
    component: () => import('@/views/Search'),
    meta: { title: '搜索' },
  },
  {
    path: '/about',
    component: () => import('@/views/About'),
  },
]

const router = createRouter({
  history: createWebHistory(),
  routes,
})

export default router
